#
# @(#) 2009, George Hrysanthopoulos, george@softekpartners.com
# @(#) This file is released under the GNU License
#
#
WHOAMI=$(USER)
PWD=$(shell pwd)
LD_LIBRARY_PATH=
#
# This is for the native Xcode cross-compiler
CCNAT = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-gcc-4.0.1
#
# This is for the open toolchain
CC =  /usr/local/arm-apple-darwin/bin/gcc

CFLAGS =  -F/Developer/Platforms/Aspen.platform/Developer/SDKs/Aspen1.2.sdk/System/Library/Frameworks \
		  -F/Developer/Platforms/Aspen.platform/Developer/SDKs/Aspen1.2.sdk/System/Library/PrivateFrameworks \
		  -I/usr/local/arm-apple-darwin/include -I. \
		  -fobjc-abi-version=2 -lobjc

ifdef DEBUG
	CFLAGS += -g -DDEBUG
endif

LDFLAGS = -march=armv6 -mcpu=arm1176jzf-s -L$(PWD)/../iphone-filesystem/usr/lib -lobjc -lcurses \
		  -bind_at_load -multiply_defined suppress

#
# Add more flags for GUI apps
LDFLAGSGUI = -march=armv6 -mcpu=arm1176jzf-s -L$(PWD)/../iphone-filesystem/usr/lib -lobjc -lcurses \
		  -F${PKG_ROOT}/System/Library/PrivateFrameworks \
		  -framework CoreFoundation \
		  -framework Foundation \
		  -framework QuartzCore \
		  -framework CoreGraphics \
		  -framework GraphicsServices \
		  -framework ImageIO \
		  -framework UIKit \
		  -bind_at_load -multiply_defined suppress

SRCS = hello.c

OBJS := $(SRCS:.m=.o)

all:	hello

hello: $(OBJS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^

%.o:	%.m
	$(CC) $(CFLAGS) -c $< -o $@

clean: 
	@rm -f hello
